import { Rule, RuleType } from "@midwayjs/validate";
import { PageDTO } from "@dto/common/page.dto";

// 查询参数
export class ListConfigDTO extends PageDTO {
  @Rule(RuleType.string())
  configName?: string;

  @Rule(RuleType.string())
  configKey?: string;

  @Rule(RuleType.string())
  configType?: string;

  @Rule(RuleType.string())
  'params[beginTime]'?: string;

  @Rule(RuleType.string())
  'params[endTime]'?: string;
}

// 新增参数
export class CreateConfigDTO {
  @Rule(RuleType.string().required())
  configName: string;

  @Rule(RuleType.string().required())
  configKey: string;

  @Rule(RuleType.string().required())
  configValue: string;

  @Rule(RuleType.string())
  configType?: string;

  @Rule(RuleType.string().max(500).allow(null, ""))
  remark?: string;
}

// 修改参数
export class UpdateConfigDTO extends CreateConfigDTO{
  @Rule(RuleType.number().required())
  configId: number;
}
